/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.cookor.poi.modules.weixin.entity;

import com.cookor.poi.modules.sys.entity.Office;
import com.cookor.poi.modules.tenant.entity.TTenant;
import com.google.common.base.Objects;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.Length;

import com.cookor.poi.common.persistence.DataEntity;

/**
 * 微信tokenEntity
 * @author poi
 * @version 2021-03-16
 */
public class TWeixinConfig extends DataEntity<TWeixinConfig> {

	private static final long serialVersionUID = 1L;
	private Integer tenantId;
	private String name;// 公众号名称
	private String appid;// 公众号ID
	private String secret;// 公众号密钥
	private String accToken;//
	private String token;
	private String accesstoken;
	private String encodingaeskey;
	private Integer authType;
	private Integer type;
	private Long expiresTime;
	private String jsapiTicket;
	private Office company; // 归属公司
	private String original;

	private String authRefreshToken;
	private String headImg;
	private Integer serviceTypeInfo;
	private Integer verifyTypeInfo;
	private String alias;
	private String businessInfo;
	private String funcInfo;
	private String qrcodeUrl;
	private String oauthUniacid;
	private String companyId;

	private String tenantName;
	private TTenant tenant;

	public String getOauthUniacid() {
		return oauthUniacid;
	}
	public void setOauthUniacid(String oauthUniacid) {
		this.oauthUniacid = oauthUniacid;
	}
	public boolean isJiequan(){
		if (StringUtils.isNotBlank(oauthUniacid)&&serviceTypeInfo != null && (serviceTypeInfo == 0 || serviceTypeInfo == 1)) {// 订阅号有借权
			return true;
		}else{
			return false;
		}
	}
	public String getOriginal() {
		return original;
	}

	public void setOriginal(String original) {
		this.original = original;
	}

	public String getHeadImg() {
		return headImg;
	}

	public void setHeadImg(String headImg) {
		this.headImg = headImg;
	}

	public Integer getServiceTypeInfo() {
		return serviceTypeInfo;
	}

	public void setServiceTypeInfo(Integer serviceTypeInfo) {
		this.serviceTypeInfo = serviceTypeInfo;
	}

	public Integer getVerifyTypeInfo() {
		return verifyTypeInfo;
	}

	public void setVerifyTypeInfo(Integer verifyTypeInfo) {
		this.verifyTypeInfo = verifyTypeInfo;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public String getBusinessInfo() {
		return businessInfo;
	}

	public void setBusinessInfo(String businessInfo) {
		this.businessInfo = businessInfo;
	}

	public String getFuncInfo() {
		return funcInfo;
	}

	public void setFuncInfo(String funcInfo) {
		this.funcInfo = funcInfo;
	}

	public String getQrcodeUrl() {
		return qrcodeUrl;
	}

	public void setQrcodeUrl(String qrcodeUrl) {
		this.qrcodeUrl = qrcodeUrl;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getAccesstoken() {
		return accesstoken;
	}

	public void setAccesstoken(String accesstoken) {
		this.accesstoken = accesstoken;
	}

	public String getEncodingaeskey() {
		return encodingaeskey;
	}

	public void setEncodingaeskey(String encodingaeskey) {
		this.encodingaeskey = encodingaeskey;
	}

	public Integer getAuthType() {
		return authType;
	}

	public void setAuthType(Integer authType) {
		this.authType = authType;
	}

	public Long getExpiresTime() {
		return expiresTime;
	}

	public void setExpiresTime(Long expiresTime) {
		this.expiresTime = expiresTime;
	}

	public String getAuthRefreshToken() {
		return authRefreshToken;
	}

	public void setAuthRefreshToken(String authRefreshToken) {
		this.authRefreshToken = authRefreshToken;
	}

	public String getAccToken() {
		return accToken;
	}

	public void setAccToken(String accToken) {
		this.accToken = accToken;
	}

	/*
	 * public String getWebId() { return webId; }
	 *
	 * public void setWebId(String webId) { this.webId = webId; }
	 */
	public String getJsapiTicket() {
		return jsapiTicket;
	}

	public void setJsapiTicket(String jsapiTicket) {
		this.jsapiTicket = jsapiTicket;
	}

	public Office getCompany() {
		return company;
	}

	public void setCompany(Office company) {
		this.company = company;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public TWeixinConfig() {
		super();
	}

	public TWeixinConfig(String id) {
		this();
		this.id = id;
	}

	public String getAppid() {
		return this.appid;
	}

	public void setAppid(String appid) {
		this.appid = appid;
	}

	public String getSecret() {
		return this.secret;
	}

	public void setSecret(String secret) {
		this.secret = secret;
	}

	public String getToken() {
		return this.token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	@Override
	public int hashCode() {
		return Objects.hashCode(id);
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null || getClass() != obj.getClass()) {
			return false;
		}
		TWeixinConfig other = (TWeixinConfig) obj;
		return Objects.equal(this.id, other.id);
	}

	public Integer getTenantId() {
		return tenantId;
	}

	public void setTenantId(Integer tenantId) {
		this.tenantId = tenantId;
	}

	public String getCompanyId() {
		return companyId;
	}

	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}

	public TTenant getTenant() {
		return tenant;
	}

	public void setTenant(TTenant tenant) {
		this.tenant = tenant;
	}

	public String getTenantName() {
		return tenantName;
	}

	public void setTenantName(String tenantName) {
		this.tenantName = tenantName;
	}
}
